import java.util.*;
import java.util.concurrent.*;

/**
 * @author hht
 * @ClassName MapTest
 * @Description TODO
 * @Date 2020/1/2 17:42
 * @VERSION 1.0
 */
public class MapTest {

    static Map<Integer, Integer> cache = new HashMap<>();

    public static void main(String[] args) throws ExecutionException, InterruptedException, TimeoutException {
        Map m = new LinkedHashMap<>(10,0.75f,true);
        m.put("a",1);
        m.put("b",1);
        m.put("c",1);
        System.out.println(m);
        System.out.println(m.get("b"));
        System.out.println(m.get("b"));

        System.out.println(m);

        BlockingQueue queue = new ArrayBlockingQueue(10);
        queue.offer(1);
        queue.poll();
        LinkedList a;
        ConcurrentLinkedQueue a1;
        List list  ;
        int i = 9;
        switch (i){
            default:
                System.out.println("default");
            case 0:
                System.out.println("zero");
                break;
            case 1:
                System.out.println("1");
            case 2:
                System.out.println("2");
        }

        FutureTask<Integer> res = new FutureTask<>(new MapTest().new CaTest(1,2));


        ExecutorService executor = Executors.newFixedThreadPool(1);
        Future<Integer> future = executor.submit( new MapTest().new CaTest(1,2));
        System.out.println(future.get(1,TimeUnit.MILLISECONDS));

    }


    public class CaTest implements Callable<Integer>{
        private int i;
        private  int j;

        public CaTest(int i,int j){
            this.i = i;
            this.j = j;
        }

        @Override
        public Integer call() throws Exception {
            Thread.sleep(100);
            return i+j;
        }
    }
}
